CREATE PROCEDURE [dbo].[Proc_ThanhVien_Insert] (
	@TenDangNhap nvarchar(50),
	@MatKhau nvarchar(50),
	@IdQuyen int,
	@TenDayDu nvarchar(50),
	@NgaySinh nvarchar(20),
	@DiaChi nvarchar(-1),
	@SoDienThoai nvarchar(20),
	@NgayThamGia nvarchar(20),
	@Email nvarchar(50),
	@TrangThai bit
)
AS

SET NOCOUNT ON

INSERT INTO [ThanhVien] (
	[TenDangNhap],
	[MatKhau],
	[IdQuyen],
	[TenDayDu],
	[NgaySinh],
	[DiaChi],
	[SoDienThoai],
	[NgayThamGia],
	[Email],
	[TrangThai]
) VALUES (
	@TenDangNhap,
	@MatKhau,
	@IdQuyen,
	@TenDayDu,
	@NgaySinh,
	@DiaChi,
	@SoDienThoai,
	@NgayThamGia,
	@Email,
	@TrangThai
)
GO
CREATE PROCEDURE [dbo].[Proc_ThanhVien_Select] 
AS

SET NOCOUNT ON

SELECT
	[TenDangNhap],
	[MatKhau],
	[IdQuyen],
	[TenDayDu],
	[NgaySinh],
	[DiaChi],
	[SoDienThoai],
	[NgayThamGia],
	[Email],
	[TrangThai]
FROM
	[ThanhVien]
GO

CREATE PROCEDURE [dbo].[Proc_ThanhVien_SelectPrimaryKey] (
	@TenDangNhap nvarchar(50)
)
AS

SET NOCOUNT ON

SELECT
	[TenDangNhap],
	[MatKhau],
	[IdQuyen],
	[TenDayDu],
	[NgaySinh],
	[DiaChi],
	[SoDienThoai],
	[NgayThamGia],
	[Email],
	[TrangThai]
FROM
	[ThanhVien]
WHERE
	[TenDangNhap] = @TenDangNhap
GO

CREATE PROCEDURE [dbo].[Proc_ThanhVien_Update] (
	@TenDangNhap nvarchar(50),
	@MatKhau nvarchar(50),
	@IdQuyen int,
	@TenDayDu nvarchar(50),
	@NgaySinh nvarchar(20),
	@DiaChi nvarchar(-1),
	@SoDienThoai nvarchar(20),
	@NgayThamGia nvarchar(20),
	@Email nvarchar(50),
	@TrangThai bit
)
AS

SET NOCOUNT ON

UPDATE
	[ThanhVien]
SET
	[MatKhau] = @MatKhau,
	[IdQuyen] = @IdQuyen,
	[TenDayDu] = @TenDayDu,
	[NgaySinh] = @NgaySinh,
	[DiaChi] = @DiaChi,
	[SoDienThoai] = @SoDienThoai,
	[NgayThamGia] = @NgayThamGia,
	[Email] = @Email,
	[TrangThai] = @TrangThai
WHERE
	[TenDangNhap] = @TenDangNhap
GO

CREATE PROCEDURE [dbo].[Proc_ThanhVien_Delete] (
	@TenDangNhap nvarchar(50)
)
AS

SET NOCOUNT ON

DELETE FROM
	[ThanhVien]
WHERE
	[TenDangNhap] = @TenDangNhap
GO
CREATE PROCEDURE [dbo].[Proc_Menu_Insert] (
	@IdMenu int,
	@IdMenuSub int,
	@TenMenu nvarchar(50),
	@SapXep int,
	@HienThi_TinTuc bit,
	@HienThi_MenuChinh bit,
	@HienThi_MenuBottom bit
)
AS

SET NOCOUNT ON

INSERT INTO [Menu] (
	[IdMenu],
	[IdMenuSub],
	[TenMenu],
	[SapXep],
	[HienThi_TinTuc],
	[HienThi_MenuChinh],
	[HienThi_MenuBottom]
) VALUES (
	@IdMenu,
	@IdMenuSub,
	@TenMenu,
	@SapXep,
	@HienThi_TinTuc,
	@HienThi_MenuChinh,
	@HienThi_MenuBottom
)
GO
CREATE PROCEDURE [dbo].[Proc_Menu_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdMenu],
	[IdMenuSub],
	[TenMenu],
	[SapXep],
	[HienThi_TinTuc],
	[HienThi_MenuChinh],
	[HienThi_MenuBottom]
FROM
	[Menu]
GO

CREATE PROCEDURE [dbo].[Proc_Menu_SelectPrimaryKey] (
	@IdMenu int
)
AS

SET NOCOUNT ON

SELECT
	[IdMenu],
	[IdMenuSub],
	[TenMenu],
	[SapXep],
	[HienThi_TinTuc],
	[HienThi_MenuChinh],
	[HienThi_MenuBottom]
FROM
	[Menu]
WHERE
	[IdMenu] = @IdMenu
GO

CREATE PROCEDURE [dbo].[Proc_Menu_Update] (
	@IdMenu int,
	@IdMenuSub int,
	@TenMenu nvarchar(50),
	@SapXep int,
	@HienThi_TinTuc bit,
	@HienThi_MenuChinh bit,
	@HienThi_MenuBottom bit
)
AS

SET NOCOUNT ON

UPDATE
	[Menu]
SET
	[IdMenuSub] = @IdMenuSub,
	[TenMenu] = @TenMenu,
	[SapXep] = @SapXep,
	[HienThi_TinTuc] = @HienThi_TinTuc,
	[HienThi_MenuChinh] = @HienThi_MenuChinh,
	[HienThi_MenuBottom] = @HienThi_MenuBottom
WHERE
	[IdMenu] = @IdMenu
GO

CREATE PROCEDURE [dbo].[Proc_Menu_Delete] (
	@IdMenu int
)
AS

SET NOCOUNT ON

DELETE FROM
	[Menu]
WHERE
	[IdMenu] = @IdMenu
GO
CREATE PROCEDURE [dbo].[Proc_TinTuc_Insert] (
	@IdTinTuc int,
	@IdMenu int,
	@TenDangNhap nvarchar(50),
	@TieuDe nvarchar(-1),
	@TomTat ntext,
	@NoiDung ntext,
	@NgayTao datetime,
	@NgayDang datetime,
	@HinhAnh nvarchar(250),
	@TuKhoa nvarchar(50),
	@Tag nvarchar(50),
	@NguonTin nvarchar(50),
	@TinNoiBat bit,
	@ChoPhepBinhLuan bit,
	@LuotXem int,
	@TrangThai bit,
	@Tinnong bit
)
AS

SET NOCOUNT ON

INSERT INTO [TinTuc] (
	[IdTinTuc],
	[IdMenu],
	[TenDangNhap],
	[TieuDe],
	[TomTat],
	[NoiDung],
	[NgayTao],
	[NgayDang],
	[HinhAnh],
	[TuKhoa],
	[Tag],
	[NguonTin],
	[TinNoiBat],
	[ChoPhepBinhLuan],
	[LuotXem],
	[TrangThai],
	[Tinnong]
) VALUES (
	@IdTinTuc,
	@IdMenu,
	@TenDangNhap,
	@TieuDe,
	@TomTat,
	@NoiDung,
	@NgayTao,
	@NgayDang,
	@HinhAnh,
	@TuKhoa,
	@Tag,
	@NguonTin,
	@TinNoiBat,
	@ChoPhepBinhLuan,
	@LuotXem,
	@TrangThai,
	@Tinnong
)
GO
CREATE PROCEDURE [dbo].[Proc_TinTuc_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdTinTuc],
	[IdMenu],
	[TenDangNhap],
	[TieuDe],
	[TomTat],
	[NoiDung],
	[NgayTao],
	[NgayDang],
	[HinhAnh],
	[TuKhoa],
	[Tag],
	[NguonTin],
	[TinNoiBat],
	[ChoPhepBinhLuan],
	[LuotXem],
	[TrangThai],
	[Tinnong]
FROM
	[TinTuc]
GO

CREATE PROCEDURE [dbo].[Proc_TinTuc_SelectPrimaryKey] (
	@IdTinTuc int
)
AS

SET NOCOUNT ON

SELECT
	[IdTinTuc],
	[IdMenu],
	[TenDangNhap],
	[TieuDe],
	[TomTat],
	[NoiDung],
	[NgayTao],
	[NgayDang],
	[HinhAnh],
	[TuKhoa],
	[Tag],
	[NguonTin],
	[TinNoiBat],
	[ChoPhepBinhLuan],
	[LuotXem],
	[TrangThai],
	[Tinnong]
FROM
	[TinTuc]
WHERE
	[IdTinTuc] = @IdTinTuc
GO

CREATE PROCEDURE [dbo].[Proc_TinTuc_Update] (
	@IdTinTuc int,
	@IdMenu int,
	@TenDangNhap nvarchar(50),
	@TieuDe nvarchar(-1),
	@TomTat ntext,
	@NoiDung ntext,
	@NgayTao datetime,
	@NgayDang datetime,
	@HinhAnh nvarchar(250),
	@TuKhoa nvarchar(50),
	@Tag nvarchar(50),
	@NguonTin nvarchar(50),
	@TinNoiBat bit,
	@ChoPhepBinhLuan bit,
	@LuotXem int,
	@TrangThai bit,
	@Tinnong bit
)
AS

SET NOCOUNT ON

UPDATE
	[TinTuc]
SET
	[IdMenu] = @IdMenu,
	[TenDangNhap] = @TenDangNhap,
	[TieuDe] = @TieuDe,
	[TomTat] = @TomTat,
	[NoiDung] = @NoiDung,
	[NgayTao] = @NgayTao,
	[NgayDang] = @NgayDang,
	[HinhAnh] = @HinhAnh,
	[TuKhoa] = @TuKhoa,
	[Tag] = @Tag,
	[NguonTin] = @NguonTin,
	[TinNoiBat] = @TinNoiBat,
	[ChoPhepBinhLuan] = @ChoPhepBinhLuan,
	[LuotXem] = @LuotXem,
	[TrangThai] = @TrangThai,
	[Tinnong] = @Tinnong
WHERE
	[IdTinTuc] = @IdTinTuc
GO

CREATE PROCEDURE [dbo].[Proc_TinTuc_Delete] (
	@IdTinTuc int
)
AS

SET NOCOUNT ON

DELETE FROM
	[TinTuc]
WHERE
	[IdTinTuc] = @IdTinTuc
GO
CREATE PROCEDURE [dbo].[Proc_BinhLuan_Insert] (
	@IdBinhLuan int,
	@IdTinTuc int,
	@TieuDe nvarchar(50),
	@TenDayDu nvarchar(50),
	@Email nvarchar(50),
	@NoiDung ntext,
	@NgayTao datetime,
	@TrangThai bit
)
AS

SET NOCOUNT ON

INSERT INTO [BinhLuan] (
	[IdBinhLuan],
	[IdTinTuc],
	[TieuDe],
	[TenDayDu],
	[Email],
	[NoiDung],
	[NgayTao],
	[TrangThai]
) VALUES (
	@IdBinhLuan,
	@IdTinTuc,
	@TieuDe,
	@TenDayDu,
	@Email,
	@NoiDung,
	@NgayTao,
	@TrangThai
)
GO
CREATE PROCEDURE [dbo].[Proc_BinhLuan_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdBinhLuan],
	[IdTinTuc],
	[TieuDe],
	[TenDayDu],
	[Email],
	[NoiDung],
	[NgayTao],
	[TrangThai]
FROM
	[BinhLuan]
GO

CREATE PROCEDURE [dbo].[Proc_BinhLuan_SelectPrimaryKey] (
	@IdBinhLuan int
)
AS

SET NOCOUNT ON

SELECT
	[IdBinhLuan],
	[IdTinTuc],
	[TieuDe],
	[TenDayDu],
	[Email],
	[NoiDung],
	[NgayTao],
	[TrangThai]
FROM
	[BinhLuan]
WHERE
	[IdBinhLuan] = @IdBinhLuan
GO

CREATE PROCEDURE [dbo].[Proc_BinhLuan_Update] (
	@IdBinhLuan int,
	@IdTinTuc int,
	@TieuDe nvarchar(50),
	@TenDayDu nvarchar(50),
	@Email nvarchar(50),
	@NoiDung ntext,
	@NgayTao datetime,
	@TrangThai bit
)
AS

SET NOCOUNT ON

UPDATE
	[BinhLuan]
SET
	[IdTinTuc] = @IdTinTuc,
	[TieuDe] = @TieuDe,
	[TenDayDu] = @TenDayDu,
	[Email] = @Email,
	[NoiDung] = @NoiDung,
	[NgayTao] = @NgayTao,
	[TrangThai] = @TrangThai
WHERE
	[IdBinhLuan] = @IdBinhLuan
GO

CREATE PROCEDURE [dbo].[Proc_BinhLuan_Delete] (
	@IdBinhLuan int
)
AS

SET NOCOUNT ON

DELETE FROM
	[BinhLuan]
WHERE
	[IdBinhLuan] = @IdBinhLuan
GO
CREATE PROCEDURE [dbo].[Proc_QuyenTruyCap_Insert] (
	@IdQuyen int,
	@TenQuyen nvarchar(50)
)
AS

SET NOCOUNT ON

INSERT INTO [QuyenTruyCap] (
	[IdQuyen],
	[TenQuyen]
) VALUES (
	@IdQuyen,
	@TenQuyen
)
GO
CREATE PROCEDURE [dbo].[Proc_QuyenTruyCap_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdQuyen],
	[TenQuyen]
FROM
	[QuyenTruyCap]
GO

CREATE PROCEDURE [dbo].[Proc_QuyenTruyCap_SelectPrimaryKey] (
	@IdQuyen int
)
AS

SET NOCOUNT ON

SELECT
	[IdQuyen],
	[TenQuyen]
FROM
	[QuyenTruyCap]
WHERE
	[IdQuyen] = @IdQuyen
GO

CREATE PROCEDURE [dbo].[Proc_QuyenTruyCap_Update] (
	@IdQuyen int,
	@TenQuyen nvarchar(50)
)
AS

SET NOCOUNT ON

UPDATE
	[QuyenTruyCap]
SET
	[TenQuyen] = @TenQuyen
WHERE
	[IdQuyen] = @IdQuyen
GO

CREATE PROCEDURE [dbo].[Proc_QuyenTruyCap_Delete] (
	@IdQuyen int
)
AS

SET NOCOUNT ON

DELETE FROM
	[QuyenTruyCap]
WHERE
	[IdQuyen] = @IdQuyen
GO
CREATE PROCEDURE [dbo].[Proc_ChuyenMuc_Insert] (
	@IdChuyenMuc int,
	@TenChuyenMuc nvarchar(50)
)
AS

SET NOCOUNT ON

INSERT INTO [ChuyenMuc] (
	[IdChuyenMuc],
	[TenChuyenMuc]
) VALUES (
	@IdChuyenMuc,
	@TenChuyenMuc
)
GO
CREATE PROCEDURE [dbo].[Proc_ChuyenMuc_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdChuyenMuc],
	[TenChuyenMuc]
FROM
	[ChuyenMuc]
GO

CREATE PROCEDURE [dbo].[Proc_ChuyenMuc_SelectPrimaryKey] (
	@IdChuyenMuc int
)
AS

SET NOCOUNT ON

SELECT
	[IdChuyenMuc],
	[TenChuyenMuc]
FROM
	[ChuyenMuc]
WHERE
	[IdChuyenMuc] = @IdChuyenMuc
GO

CREATE PROCEDURE [dbo].[Proc_ChuyenMuc_Update] (
	@IdChuyenMuc int,
	@TenChuyenMuc nvarchar(50)
)
AS

SET NOCOUNT ON

UPDATE
	[ChuyenMuc]
SET
	[TenChuyenMuc] = @TenChuyenMuc
WHERE
	[IdChuyenMuc] = @IdChuyenMuc
GO

CREATE PROCEDURE [dbo].[Proc_ChuyenMuc_Delete] (
	@IdChuyenMuc int
)
AS

SET NOCOUNT ON

DELETE FROM
	[ChuyenMuc]
WHERE
	[IdChuyenMuc] = @IdChuyenMuc
GO
CREATE PROCEDURE [dbo].[Proc_HinhAnh_Insert] (
	@IdHinhAnh int,
	@IDChuyenMuc int,
	@TenFile nvarchar(100),
	@TenHienThi nvarchar(100),
	@MoTa nvarchar(100),
	@NgayUpload nvarchar(20),
	@NgayCapNhat nvarchar(20),
	@TrangThai bit,
	@TenDangNhap nvarchar(50)
)
AS

SET NOCOUNT ON

INSERT INTO [HinhAnh] (
	[IdHinhAnh],
	[IDChuyenMuc],
	[TenFile],
	[TenHienThi],
	[MoTa],
	[NgayUpload],
	[NgayCapNhat],
	[TrangThai],
	[TenDangNhap]
) VALUES (
	@IdHinhAnh,
	@IDChuyenMuc,
	@TenFile,
	@TenHienThi,
	@MoTa,
	@NgayUpload,
	@NgayCapNhat,
	@TrangThai,
	@TenDangNhap
)
GO
CREATE PROCEDURE [dbo].[Proc_HinhAnh_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdHinhAnh],
	[IDChuyenMuc],
	[TenFile],
	[TenHienThi],
	[MoTa],
	[NgayUpload],
	[NgayCapNhat],
	[TrangThai],
	[TenDangNhap]
FROM
	[HinhAnh]
GO

CREATE PROCEDURE [dbo].[Proc_HinhAnh_SelectPrimaryKey] (
	@IdHinhAnh int
)
AS

SET NOCOUNT ON

SELECT
	[IdHinhAnh],
	[IDChuyenMuc],
	[TenFile],
	[TenHienThi],
	[MoTa],
	[NgayUpload],
	[NgayCapNhat],
	[TrangThai],
	[TenDangNhap]
FROM
	[HinhAnh]
WHERE
	[IdHinhAnh] = @IdHinhAnh
GO

CREATE PROCEDURE [dbo].[Proc_HinhAnh_Update] (
	@IdHinhAnh int,
	@IDChuyenMuc int,
	@TenFile nvarchar(100),
	@TenHienThi nvarchar(100),
	@MoTa nvarchar(100),
	@NgayUpload nvarchar(20),
	@NgayCapNhat nvarchar(20),
	@TrangThai bit,
	@TenDangNhap nvarchar(50)
)
AS

SET NOCOUNT ON

UPDATE
	[HinhAnh]
SET
	[IDChuyenMuc] = @IDChuyenMuc,
	[TenFile] = @TenFile,
	[TenHienThi] = @TenHienThi,
	[MoTa] = @MoTa,
	[NgayUpload] = @NgayUpload,
	[NgayCapNhat] = @NgayCapNhat,
	[TrangThai] = @TrangThai,
	[TenDangNhap] = @TenDangNhap
WHERE
	[IdHinhAnh] = @IdHinhAnh
GO

CREATE PROCEDURE [dbo].[Proc_HinhAnh_Delete] (
	@IdHinhAnh int
)
AS

SET NOCOUNT ON

DELETE FROM
	[HinhAnh]
WHERE
	[IdHinhAnh] = @IdHinhAnh
GO
CREATE PROCEDURE [dbo].[Proc_VideoClip_Insert] (
	@IdVideo int,
	@IdChuyenMuc int,
	@TenFile nvarchar(50),
	@HinhAnhMoTa nvarchar(250),
	@GioiThieu nvarchar(250),
	@NgayUpload nvarchar(20),
	@NgayCapNhat nvarchar(20),
	@TrangThai bit,
	@TenDangNhap nvarchar(50)
)
AS

SET NOCOUNT ON

INSERT INTO [VideoClip] (
	[IdVideo],
	[IdChuyenMuc],
	[TenFile],
	[HinhAnhMoTa],
	[GioiThieu],
	[NgayUpload],
	[NgayCapNhat],
	[TrangThai],
	[TenDangNhap]
) VALUES (
	@IdVideo,
	@IdChuyenMuc,
	@TenFile,
	@HinhAnhMoTa,
	@GioiThieu,
	@NgayUpload,
	@NgayCapNhat,
	@TrangThai,
	@TenDangNhap
)
GO
CREATE PROCEDURE [dbo].[Proc_VideoClip_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdVideo],
	[IdChuyenMuc],
	[TenFile],
	[HinhAnhMoTa],
	[GioiThieu],
	[NgayUpload],
	[NgayCapNhat],
	[TrangThai],
	[TenDangNhap]
FROM
	[VideoClip]
GO

CREATE PROCEDURE [dbo].[Proc_VideoClip_SelectPrimaryKey] (
	@IdVideo int
)
AS

SET NOCOUNT ON

SELECT
	[IdVideo],
	[IdChuyenMuc],
	[TenFile],
	[HinhAnhMoTa],
	[GioiThieu],
	[NgayUpload],
	[NgayCapNhat],
	[TrangThai],
	[TenDangNhap]
FROM
	[VideoClip]
WHERE
	[IdVideo] = @IdVideo
GO

CREATE PROCEDURE [dbo].[Proc_VideoClip_Update] (
	@IdVideo int,
	@IdChuyenMuc int,
	@TenFile nvarchar(50),
	@HinhAnhMoTa nvarchar(250),
	@GioiThieu nvarchar(250),
	@NgayUpload nvarchar(20),
	@NgayCapNhat nvarchar(20),
	@TrangThai bit,
	@TenDangNhap nvarchar(50)
)
AS

SET NOCOUNT ON

UPDATE
	[VideoClip]
SET
	[IdChuyenMuc] = @IdChuyenMuc,
	[TenFile] = @TenFile,
	[HinhAnhMoTa] = @HinhAnhMoTa,
	[GioiThieu] = @GioiThieu,
	[NgayUpload] = @NgayUpload,
	[NgayCapNhat] = @NgayCapNhat,
	[TrangThai] = @TrangThai,
	[TenDangNhap] = @TenDangNhap
WHERE
	[IdVideo] = @IdVideo
GO

CREATE PROCEDURE [dbo].[Proc_VideoClip_Delete] (
	@IdVideo int
)
AS

SET NOCOUNT ON

DELETE FROM
	[VideoClip]
WHERE
	[IdVideo] = @IdVideo
GO
CREATE PROCEDURE [dbo].[Proc_TaiNguyen_Insert] (
	@IdTaiNguyen int,
	@IdChuyenMuc int,
	@IdThuVien int,
	@TenDangNhap nvarchar(50),
	@TenTapTin nvarchar(50),
	@DuongDanTapTin nvarchar(250),
	@DungLuongTapTin nvarchar(10),
	@MoTaTapTin nchar(10),
	@HinhAnhMoTa nvarchar(250),
	@SoLuotTaiVe nchar(10),
	@TrangThai bit
)
AS

SET NOCOUNT ON

INSERT INTO [TaiNguyen] (
	[IdTaiNguyen],
	[IdChuyenMuc],
	[IdThuVien],
	[TenDangNhap],
	[TenTapTin],
	[DuongDanTapTin],
	[DungLuongTapTin],
	[MoTaTapTin],
	[HinhAnhMoTa],
	[SoLuotTaiVe],
	[TrangThai]
) VALUES (
	@IdTaiNguyen,
	@IdChuyenMuc,
	@IdThuVien,
	@TenDangNhap,
	@TenTapTin,
	@DuongDanTapTin,
	@DungLuongTapTin,
	@MoTaTapTin,
	@HinhAnhMoTa,
	@SoLuotTaiVe,
	@TrangThai
)
GO
CREATE PROCEDURE [dbo].[Proc_TaiNguyen_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdTaiNguyen],
	[IdChuyenMuc],
	[IdThuVien],
	[TenDangNhap],
	[TenTapTin],
	[DuongDanTapTin],
	[DungLuongTapTin],
	[MoTaTapTin],
	[HinhAnhMoTa],
	[SoLuotTaiVe],
	[TrangThai]
FROM
	[TaiNguyen]
GO

CREATE PROCEDURE [dbo].[Proc_TaiNguyen_SelectPrimaryKey] (
	@IdTaiNguyen int
)
AS

SET NOCOUNT ON

SELECT
	[IdTaiNguyen],
	[IdChuyenMuc],
	[IdThuVien],
	[TenDangNhap],
	[TenTapTin],
	[DuongDanTapTin],
	[DungLuongTapTin],
	[MoTaTapTin],
	[HinhAnhMoTa],
	[SoLuotTaiVe],
	[TrangThai]
FROM
	[TaiNguyen]
WHERE
	[IdTaiNguyen] = @IdTaiNguyen
GO

CREATE PROCEDURE [dbo].[Proc_TaiNguyen_Update] (
	@IdTaiNguyen int,
	@IdChuyenMuc int,
	@IdThuVien int,
	@TenDangNhap nvarchar(50),
	@TenTapTin nvarchar(50),
	@DuongDanTapTin nvarchar(250),
	@DungLuongTapTin nvarchar(10),
	@MoTaTapTin nchar(10),
	@HinhAnhMoTa nvarchar(250),
	@SoLuotTaiVe nchar(10),
	@TrangThai bit
)
AS

SET NOCOUNT ON

UPDATE
	[TaiNguyen]
SET
	[IdChuyenMuc] = @IdChuyenMuc,
	[IdThuVien] = @IdThuVien,
	[TenDangNhap] = @TenDangNhap,
	[TenTapTin] = @TenTapTin,
	[DuongDanTapTin] = @DuongDanTapTin,
	[DungLuongTapTin] = @DungLuongTapTin,
	[MoTaTapTin] = @MoTaTapTin,
	[HinhAnhMoTa] = @HinhAnhMoTa,
	[SoLuotTaiVe] = @SoLuotTaiVe,
	[TrangThai] = @TrangThai
WHERE
	[IdTaiNguyen] = @IdTaiNguyen
GO

CREATE PROCEDURE [dbo].[Proc_TaiNguyen_Delete] (
	@IdTaiNguyen int
)
AS

SET NOCOUNT ON

DELETE FROM
	[TaiNguyen]
WHERE
	[IdTaiNguyen] = @IdTaiNguyen
GO
CREATE PROCEDURE [dbo].[Proc_ThuVien_Insert] (
	@IdThuVien int,
	@TenThuVien nvarchar(50)
)
AS

SET NOCOUNT ON

INSERT INTO [ThuVien] (
	[IdThuVien],
	[TenThuVien]
) VALUES (
	@IdThuVien,
	@TenThuVien
)
GO
CREATE PROCEDURE [dbo].[Proc_ThuVien_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdThuVien],
	[TenThuVien]
FROM
	[ThuVien]
GO

CREATE PROCEDURE [dbo].[Proc_ThuVien_SelectPrimaryKey] (
	@IdThuVien int
)
AS

SET NOCOUNT ON

SELECT
	[IdThuVien],
	[TenThuVien]
FROM
	[ThuVien]
WHERE
	[IdThuVien] = @IdThuVien
GO

CREATE PROCEDURE [dbo].[Proc_ThuVien_Update] (
	@IdThuVien int,
	@TenThuVien nvarchar(50)
)
AS

SET NOCOUNT ON

UPDATE
	[ThuVien]
SET
	[TenThuVien] = @TenThuVien
WHERE
	[IdThuVien] = @IdThuVien
GO

CREATE PROCEDURE [dbo].[Proc_ThuVien_Delete] (
	@IdThuVien int
)
AS

SET NOCOUNT ON

DELETE FROM
	[ThuVien]
WHERE
	[IdThuVien] = @IdThuVien
GO
CREATE PROCEDURE [dbo].[Proc_QuangCao_Insert] (
	@IdQuangCao int,
	@IdViTriHienthi int,
	@TenQuangCao nvarchar(100),
	@HinhAnh nvarchar(250),
	@LienKet nvarchar(250),
	@NgayUpload nvarchar(20),
	@TrangThai bit
)
AS

SET NOCOUNT ON

INSERT INTO [QuangCao] (
	[IdQuangCao],
	[IdViTriHienthi],
	[TenQuangCao],
	[HinhAnh],
	[LienKet],
	[NgayUpload],
	[TrangThai]
) VALUES (
	@IdQuangCao,
	@IdViTriHienthi,
	@TenQuangCao,
	@HinhAnh,
	@LienKet,
	@NgayUpload,
	@TrangThai
)
GO
CREATE PROCEDURE [dbo].[Proc_QuangCao_Select] 
AS

SET NOCOUNT ON

SELECT
	[IdQuangCao],
	[IdViTriHienthi],
	[TenQuangCao],
	[HinhAnh],
	[LienKet],
	[NgayUpload],
	[TrangThai]
FROM
	[QuangCao]
GO

CREATE PROCEDURE [dbo].[Proc_QuangCao_SelectPrimaryKey] (
	@IdQuangCao int
)
AS

SET NOCOUNT ON

SELECT
	[IdQuangCao],
	[IdViTriHienthi],
	[TenQuangCao],
	[HinhAnh],
	[LienKet],
	[NgayUpload],
	[TrangThai]
FROM
	[QuangCao]
WHERE
	[IdQuangCao] = @IdQuangCao
GO

CREATE PROCEDURE [dbo].[Proc_QuangCao_Update] (
	@IdQuangCao int,
	@IdViTriHienthi int,
	@TenQuangCao nvarchar(100),
	@HinhAnh nvarchar(250),
	@LienKet nvarchar(250),
	@NgayUpload nvarchar(20),
	@TrangThai bit
)
AS

SET NOCOUNT ON

UPDATE
	[QuangCao]
SET
	[IdViTriHienthi] = @IdViTriHienthi,
	[TenQuangCao] = @TenQuangCao,
	[HinhAnh] = @HinhAnh,
	[LienKet] = @LienKet,
	[NgayUpload] = @NgayUpload,
	[TrangThai] = @TrangThai
WHERE
	[IdQuangCao] = @IdQuangCao
GO

CREATE PROCEDURE [dbo].[Proc_QuangCao_Delete] (
	@IdQuangCao int
)
AS

SET NOCOUNT ON

DELETE FROM
	[QuangCao]
WHERE
	[IdQuangCao] = @IdQuangCao
GO
